package com.gy.util;

import cn.hutool.core.codec.Morse;
import cn.hutool.core.codec.Rot;
import cn.hutool.crypto.digest.DigestUtil;

public class EncryptionUtils {
    public static void main(String[] args) {
        System.out.println(encrypt("1845727548330199990"+"K2M98E"));
        System.out.println(encrypt("1845727548330199991"+"4YK0XB"));
        System.out.println(encrypt("1845727548330199992"+"F4BD4F"));
        System.out.println(encrypt("1845727548330199993"+"PWJM27"));
        System.out.println(encrypt("1845727548330199994"+"54491X"));
        System.out.println(encrypt("1845727548330199995"+"BXRR9W"));
        System.out.println(encrypt("1845727548330199996"+"7KC24C"));
        System.out.println(encrypt("1845727548330199997"+"70619X"));
    }
    public static String encrypt(String passWorld) {
        final Morse morseCoder = new Morse();
        passWorld= DigestUtil.md5Hex(passWorld);
        passWorld= Rot.encode13(passWorld.toUpperCase());
        passWorld=morseCoder.encode(passWorld);
        return passWorld;
    }

    public static Boolean match(String passWorld,String encryptionPassWorld) {
        final Morse morseCoder = new Morse();
        passWorld= DigestUtil.md5Hex(passWorld);
        passWorld= Rot.encode13(passWorld.toUpperCase());
        passWorld=morseCoder.encode(passWorld);
        return passWorld.equals(encryptionPassWorld);
    }

}
